home *** CD-ROM | disk | FTP | other *** search
/ comtecelectrical.ca / www.comtecelectrical.ca.tar / www.comtecelectrical.ca / infobots / Backup / MSOCache / All Users / 90000409-6000-11D3-8CFE-0150048383C9 / Q2561411.CAB / POWERPNT.EXE / RCDATA / 5902 < prev    next >
Text File  |  2003-07-30  |  8KB  |  305 lines

  1.  
  2. /*********************************************
  3.  Frameset functions
  4.  
  5.  These functions control slide navigation
  6.  and state of the frameset.
  7. **********************************************/
  8.  
  9. function FullScrInit()
  10. {
  11.     g_allowAdvOnClick = GetCurSld().mAdvOnClk
  12.     document.body.style.backgroundColor="black"
  13.     document.oncontextmenu=parent._CM;
  14.     document.onkeydown = _KDH;
  15.     document.ondragstart=Cancel
  16.     document.onselectstart=Cancel
  17.     self.focus()
  18. }
  19.  
  20. function Redirect( frmId )
  21. {    
  22.     var str=document.location.hash,idx=str.indexOf('#'), sId=GetSldId()
  23.     if(idx>=0) str=str.substr(1);
  24.     if( window.name != frmId && ( sId != str) ) {
  25.         obj = GetObj("Main-File")
  26.         window.location.href=obj.href+"#"+sId
  27.         return 1
  28.     }
  29.     return 0
  30. }
  31.  
  32. var MHTMLPrefix = CalculateMHTMLPrefix(); 
  33. function CalculateMHTMLPrefix()
  34. {
  35.     if ( document.location.protocol == 'mhtml:') { 
  36.         href=new String(document.location.href) 
  37.         Start=href.indexOf('!')+1 
  38.         End=href.lastIndexOf('/')+1 
  39.         if (End < Start) 
  40.             return href.substring(0, Start) 
  41.         else 
  42.         return href.substring(0, End) 
  43.     }
  44.     return '';
  45. }
  46.  
  47. function GetTags(base,tag)
  48. {
  49.     if(g_supportsPPTHTML) return base.all.tags(tag);
  50.     else return base.getElementsByTagName(tag);
  51. }
  52.  
  53.  
  54. function UpdNtsPane(){ if(frames["PPTNts"]) PPTNts.location.replace( MHTMLPrefix+GetHrefObj( gCurSld ).mNtsHref ) }
  55.  
  56. function UpdNavPane( sldIndex ){ if(gNavLoaded) PPTNav.UpdNav() }
  57.  
  58. function UpdOtNavPane(){ if(gOtlNavLoaded) PPTOtlNav.UpdOtlNav() }
  59.  
  60. function UpdOtlPane(){ if(gOtlLoaded) PPTOtl.UpdOtl() }
  61.  
  62. function SetHasNts( fVal )
  63. {
  64.     if( gHasNts != fVal ) {
  65.         gHasNts=fVal
  66.         UpdNavPane()
  67.     }
  68. }
  69.  
  70. function ToggleOtlText()
  71. {
  72.     gOtlTxtExp=!gOtlTxtExp
  73.     UpdOtlPane()
  74. }
  75.  
  76. function ClearMedia()
  77. {
  78.     // Clear any sounds playing before launching another browser window. Otherwise,
  79.     // in fullscreen mode, you'll continue to hear the sound in the frames mode.
  80.     if (PPTSld.pptSound) PPTSld.pptSound.loop = 0;
  81. }
  82.  
  83. function FullScreen()
  84.     if ( PPTSld.g_animUseRuntime )
  85.         PPTSld.document.body.pause();
  86.     ClearMedia();
  87.     var href = ( document.location.protocol == 'mhtml:') ? FULLSCR_HREF : FULLSCR_HREF+"#"+GetHrefObj(gCurSld).mSldHref;
  88.     if(PPTNav.event.ctrlKey) {
  89.         var w = (window.screen.availWidth * 1.0) / 2.0
  90.         var h = w * (PPTSld.g_origH * 1.0) / PPTSld.g_origW
  91.         win = window.open( MHTMLPrefix+href,null,"toolbar=0,resizable=1,top=0,left=0," + "width="+ w + ",height=" + h );
  92.         if( win.document.body && PPTSld.g_animUseRuntime )
  93.             win.document.body.PPTSldFrameset=window;
  94.     }
  95.     else
  96.     {
  97.         win = window.open( MHTMLPrefix+href,null,"fullscreen=yes" );
  98.         if( win.document.body && PPTSld.g_animUseRuntime )
  99.             win.document.body.PPTSldFrameset=window;
  100.     }
  101. }
  102.  
  103. function ToggleVNarration()
  104. {
  105.     rObj=PPTSld.document.all("NSPlay")
  106.     if( rObj && !PPTSld.g_animUseRuntime ) {
  107.         if( (rObj.playState == 1)||(rObj.playState == 0) )
  108.             rObj.Play()
  109.         else if( rObj.playState == 2 )
  110.             rObj.Pause()
  111.         else
  112.             return;
  113.     }
  114.     else if( PPTSld.g_animUseRuntime )
  115.     {
  116.         narObj = PPTSld.document.all("narrationID")
  117.         if( narObj )
  118.             narObj.togglePause()
  119.     }
  120. }
  121.  
  122. function GetCurSldNum()
  123. {   
  124.     obj=GetHrefObj(gCurSld)
  125.     if( obj.mOrigVis == 1 )
  126.         return obj.mSldIdx
  127.     else   
  128.         return gCurSld
  129. }
  130.  
  131. function GetNumSlds()
  132. {   
  133.     if( GetHrefObj(gCurSld).mOrigVis == 1 )
  134.         return GetSldList().mNumVisSlds;
  135.     else
  136.         return GetSldList().mList.length
  137. }
  138.  
  139. function GetSldNum( href )
  140. {
  141.     for(ii=0; ii<GetSldList().mList.length; ii++) {
  142.         if ( GetSldList().mList[ii].mSldHref == href )
  143.             return ii+1
  144.     }
  145.     return 1
  146. }
  147.  
  148. function GetHrefObj( sldIdx ){ return GetSldList().mList[sldIdx-1] }
  149.  
  150. function IsFramesMode(){ return ( SCREEN_MODE == "Frames" ) }
  151.  
  152. function IsFullScrMode(){ return ( SCREEN_MODE == "FullScreen" ) }
  153.  
  154. function GoToNextSld()
  155. {
  156.     ii=gCurSld + 1
  157.     if( GetHrefObj( ii-1 ).mOrigVis == 0 ) {
  158.         if( ii<=GetSldList().mList.length ) {
  159.             obj=GetHrefObj(ii)
  160.             obj.mVis=1
  161.             GoToSldNum(ii)
  162.             return
  163.         }
  164.     }
  165.     else {
  166.         obj=GetHrefObj( ii )
  167.         while ( obj && ( obj.mOrigVis == 0 ) )
  168.             obj=GetHrefObj(++ii)
  169.         if( obj && obj.mOrigVis ) {
  170.             GoToSldNum(ii)
  171.             return
  172.         }
  173.     }
  174.     if( gSldStack.length > 1 )
  175.         PopSldList();
  176.     else if( !IsFramesMode() ) {
  177.                 if( gLoopCont )
  178.             GoToFirst()
  179.                 else
  180.             EndShow()
  181.     }
  182. }
  183.  
  184. function GoToPrevSld()
  185. {
  186.     ii=gCurSld-1
  187.     if( ii > 0 ) {
  188.         obj=GetHrefObj(ii)
  189.         while ( obj && ( obj.mVis == 0 ) && ( ii>0 ) )
  190.             obj=GetHrefObj(--ii)
  191.         if( ii == 0 ) ii=1
  192.         GoToSldNum(ii)
  193.     }
  194. }
  195.  
  196. function GoToFirst(){ GoToSld( GetHrefObj(1).mSldHref ) }
  197.  
  198. function GoToLast()
  199. {
  200.     ii=GetSldList().mList.length
  201.     if( ii != gCurSld )
  202.         GoToSld( GetHrefObj(ii).mSldHref )
  203. }
  204.  
  205. function GoToSldNum( num )
  206. {
  207.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  208.     obj = GetHrefObj( num )
  209.     obj.mVis=1
  210.     gPrevSld=gCurSld
  211.     gCurSld = num;
  212.     PPTSld.location.replace(MHTMLPrefix+obj.mSldHref)
  213.     if( IsFramesMode() ) {
  214.         UpdNavPane(); UpdOtlPane(); UpdNtsPane()
  215.     }
  216. }
  217.  
  218. function GoToSld( href )
  219. {
  220.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  221.     GetHrefObj( GetSldNum(href) ).mVis=1
  222.     PPTSld.location.replace(MHTMLPrefix+href)
  223. }
  224.  
  225. function SldUpdated( id )
  226. {
  227.     if( id == GetHrefObj(gCurSld).mSldHref ) return
  228.     gPrevSld=gCurSld
  229.     gCurSld=GetSldNum(id)
  230.     if( IsFramesMode() ) {
  231.         UpdNavPane(); UpdOtlPane(); UpdNtsPane()
  232.     }
  233. }
  234.  
  235. function PrevSldViewed(){ GoToSld( GetHrefObj(gPrevSld).mSldHref ) }
  236. function HasPrevSld() { return ( gIsEndShow || ( gCurSld != 1 && GetHrefObj( gCurSld-1 ).mVis == 1 )||( GetCurSldNum() > 1 ) ) }
  237. function HasNextSld() { return (GetCurSldNum() != GetNumSlds()) }
  238.  
  239. function CloseWindow() {
  240.     if( HideMenu() ) return;
  241.     
  242.     var event = PPTSld.event;
  243.     if( !IsFramesMode() && event && (event.keyCode==27 || event.keyCode==32 || event.type=="click" ) )
  244.         window.close( self );
  245.     CatchNumKeys( self, event );
  246. }
  247.  
  248. function Unload() { gIsEndShow=0; }
  249.  
  250. function SetupEndShow() {
  251.     gIsEndShow=1;
  252.     PPTSld.document.body.scroll="no";
  253.     PPTSld.document.onkeypress=CloseWindow;
  254.     PPTSld.document.onclick=CloseWindow;
  255.     PPTSld.document.oncontextmenu=_CM;
  256. }
  257.  
  258. function EndShow()
  259. {
  260.     if( IsFramesMode() ) return
  261.     if( PPTSld.event ) PPTSld.event.cancelBubble=true
  262.  
  263.     doc=PPTSld.document
  264.     var dir = doc.body.dir
  265.     if( dir != "rtl" ) dir = "ltr";
  266.     doc.open()
  267.     doc.writeln('<html><body dir=' + dir + ' bgcolor=black onload=parent.SetupEndShow() onunload=parent.Unload()><center><p><font face=Tahoma color=white size=2><br><b>' + ENDSHOW_MESG + '</b></font></p></center></body></html>')
  268.     doc.close()
  269. }
  270.  
  271. function SetSldVisited(){ GetSldList().mList[gCurSld-1].mVisited=true }
  272.  
  273. function IsSldVisited(){ return GetSldList().mList[gCurSld-1].mVisited }
  274.  
  275. function hrefList( sldHref, visible, advDelay, advClk )
  276. {
  277.     this.mSldHref= this.mNtsHref = sldHref
  278.     this.mOrigVis= this.mVis = visible
  279.     this.mVisited= false
  280.     this.mAdvDelay= advDelay
  281.     this.mAdvOnClk= advClk
  282. }
  283.  
  284. function SldList(arr,curSld,fEnd)
  285. {
  286.     this.mCurSld = curSld;
  287.     this.mList = new Array();
  288.  
  289.     var idx = 1;
  290.     for(ii=0;ii<arr.length;ii++) {
  291.         this.mList[ii] = new hrefList( arr[ii].mSldHref, arr[ii].mOrigVis, arr[ii].mAdvDelay, arr[ii].mAdvOnClk );
  292.         if( arr[ii].mOrigVis )
  293.             this.mList[ii].mSldIdx = idx++;
  294.     }
  295.     this.mNumVisSlds = idx-1;
  296.     this.fEndShow = fEnd;
  297. }
  298.  
  299. function GetSldList() {    return gSldStack[gSldStack.length-1] }
  300. function GetCurSld() { return parent.GetSldList().mList[parent.gCurSld - 1] }
  301.  
  302. gSldStack = new Array();
  303. gSldStack[0] = new SldList(gMainDoc,gCurSld,1)
  304.